package com.bootdo.common.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.bootdo.system.filter.LogInterceptor;

@SuppressWarnings("deprecation")
@Component
class WebConfigurer extends WebMvcConfigurerAdapter {
	@Autowired
	BootdoConfig bootdoConfig;
	
	/**
	* 授权拦截的路径 addPathPatterns：拦截的路径 excludePathPatterns：不拦截的路径
	*/
//	@Override
//	public void addInterceptors(InterceptorRegistry registry) {
//		registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**");
//		super.addInterceptors(registry);
//		}
	
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
//		String fileFalg="https://ceshi20190703.oss-cn-beijing.aliyuncs.com///";
//		registry.addResourceHandler("/upLoad/**").addResourceLocations(fileFalg+bootdoConfig.getUploadPath());
		registry.addResourceHandler("/upLoad/**").addResourceLocations("file:///"+bootdoConfig.getUploadPath());
	}

}